package metricsdata;

import java.util.ArrayList;


/**
 * Metric that holds exactly one value of type Double.
 */
public class DoubleValueMetric extends AbstractMetricAttribute  {

	/**
	 * The metrics value: a Double.
	 */
	private Double value;
	
	
	/**
	 * Constructor of a DoubleValueMetric
	 * @param value
	 * 		the value of the metric (as Double)
	 * @param idOfMetricNamesInterface
	 * 		the id/nr of that metric in @MetricNamesInterface
	 */
	public DoubleValueMetric(Double value, String shortcut, String fullName, String description) {
		
		super(shortcut,fullName,description);
		
		this.value = value;
	}
	
	/**
	 * Constructor of a DoubleValueMetric
	 * @param value
	 * 		the value of the metric (as String)
	 * @param idOfMetricNamesInterface
	 * 		the id/nr of that metric in @MetricNamesInterface
	 */
	public DoubleValueMetric(String value, String shortcut, String fullName, String description){
		
		super(shortcut,fullName,description);
		
		this.value = new Double(value);
	}
	
	@Override
	public Double getValue(){
		return value;
	}

	/**
	 * Returns its value as Double. 
	 * @return
	 * 		value casted to Double
	 */
	public Double getValueAsDouble() {
		return value;
	}

	@Override
	public Double getAvgValue() {
		return value;
	}

	@Override
	public Double getFirstValue() {
		return value;
	}

	@Override
	public Integer getItemCount() {
		return 1;
	}

	@Override
	public Double getMaxValue() {
		return value;
	}

	@Override
	public Double getSumValue() {
		return value;
	}

	@Override
	public String toDatabaseString() {
		return value.toString();
	}

	@Override
	public Double getMinValue() {
		return value;
	}
}
